// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
// This source file is part of the Cangjie project, licensed under Apache-2.0
// with Runtime Library Exception.
//
// See https://cangjie-lang.cn/pages/LICENSE for license information.

#ifndef PLATFORM_ENVIRONMENTVARIABLE_H
#define PLATFORM_ENVIRONMENTVARIABLE_H

#include <string>
#include <memory>

#include "Path.h"

namespace Platform {

class EnvironmentVariable {
public:
    std::string name;
    std::string value;
    bool expand;

    static const std::string Separator;

    EnvironmentVariable(std::string name, std::string value);

    EnvironmentVariable(std::string name, std::string value, bool expand);

    std::string ExpandValue() const;

    std::string GenerateCommand() const;

    std::string GenerateCommandExpand() const;

    std::string GenerateCommandUnExpand() const;

    static std::unique_ptr<EnvironmentVariable> Get(const std::string &name);

    static std::unique_ptr<std::string> GetValue(const std::string &name);

    static std::unique_ptr<Path> GetPath(const std::string &name);
};

} // namespace Platform

#endif // PLATFORM_ENVIRONMENTVARIABLE_H
